package control

import (
	"fmt"
	"github.com/gin-gonic/gin"
)

func DoCookie(c *gin.Context){
	cookie, err := c.Cookie("name")
	if err != nil {
		cookie = ""
		//SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool)
		//maxAge 有效期
		//path  针对路由
		//domain  针对域名
		//secure 是否智能通过https访问
		//httpOnly bool  是否允许别人通过js获取自己的cookie
		c.SetCookie("name","go", 60*60, "/","localhost", false, true)
	}
	fmt.Println(cookie)
}


